<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'CategoryList.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link type="text/css" rel="stylesheet"
	href="/EasyBuy/statics/css/style.css" />

<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/menu.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/lrscroll_1.js"></script>


<script type="text/javascript" src="/EasyBuy/statics/js/n_nav.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
</head>
<body>
	<c:if test="${list1==null }">
		<%
			System.out.print("1");
			request.getRequestDispatcher(
						"/IndexServlet?opr=type&hre=CategoryList").forward(request, response);
		%>
	</c:if>
	<!-- 头部 -->

	<%@ include file="../../common/header.jsp"%>
	<%@ include file="../../common/preHeader.jsp"%>
	<!--Begin Header Begin-->

	
	
	<!--End Menu End-->
	<div class="i_bg">
		<div class="postion">
			<span class="fl">全部 > 美妆个护 > 香水 > </span> <span class="n_ch">
				<span class="fl">品牌：<font>香奈儿</font> </span> <a href="#"><img
					src="/EasyBuy/statics/images/s_close.gif" /> </a> </span>
		</div>
		<!--Begin 筛选条件 Begin-->
		<div class="content mar_10">
			<table border="0" class="choice"
				style="width:100%; font-family:'宋体'; margin:0 auto;" cellspacing="0"
				cellpadding="0">
				<tr valign="top">
					<td width="70">&nbsp; 品牌：</td>
					<td class="td_a"><c:forEach items="${brands }" var="brand">
							<a name="${brand.brand_id }" class="now">${brand.brand_name }</a>
						</c:forEach></td>
				</tr>
				<tr valign="top">
					<td width="8%">&nbsp; 一级：</td>
					<td width="94%" class="td_a" id="oneLevel"></td>
				</tr>
				<tr>
					<td width="8%">&nbsp; 二级：</td>
					<td width="94%" class="td_a" id="twoLevel"></td>
				</tr>
				<tr>
					<td width="8%">&nbsp; 三级：</td>
					<td width="94%" class="td_a" id="threeLevel"></td>
				</tr>

			</table>
		</div>
		<!--End 筛选条件 End-->
		<div class="content mar_20">
			<!-- 引用浏览历史页面  -->
			<%@ include file="../../common/CategorySide.jsp"%>	
			<div class="l_list">
				<div class="list_t">
					<span class="fl list_or"> <a>默认</a> <a>
							<span class="fl">销量</span> <span class="i_up" id="xiaoShang">销量从低到高显示</span> <span
							class="i_down" id="xiaoXia">销量从高到低显示</span> </a> <a> <span class="fl">价格</span>
							<span class="i_up" id="sheng">价格从低到高显示</span> <span
							class="i_down" id="jiang">价格从高到低显示</span> </a> <a id="xin">新品</a> </span> <span
						class="fr">共发现${oneCategoryCount }件</span>
				</div>
				<div class="list_c">

					<ul class="cate_list" title="${id }">

						<c:forEach items="${categoryLists }" var="categoryList">
							<li class="listInfo" >
								<div class="img">
									<a
										href="ConmmodityDetailsServlet?opr=productDetils&id=${categoryList.id }"><img
										src="/EasyBuy/statics/images/${categoryList.fileName }"
										width="210" height="185" /> </a>
								</div>
								<div class="price">
									<font>￥<span>${categoryList.price }</span> </font>&nbsp;${categoryList.integral
									}R
								</div>
								<div class="name">
									<a href="#">${categoryList.name }</a>
								</div>
								<div class="carbg">
									<a class="ss" title="${categoryList.id }">收藏</a> <a title="${categoryList.id }" class="j_car">加入购物车</a>
								</div></li>
						</c:forEach>
					</ul>

					<div class="pages">
						<a class="p_pre">上一页</a><a class="cur">1</a><a class="p_pre">下一页</a>
					</div>



				</div>
			</div>
		</div>
		<%@ include file="../../common/footer.jsp"%>

		<!-- 脚部 -->
	</div>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		function hideType() {
			$(".leftNav").hide();
		}
		hideType();
		$.getJSON("ConmmodityListServlet","opr=categorysBrandId&brand_id=1&level=1",callBack1);
			function callBack1(data1) {
				$("#oneLevel").html("");
				for ( var i = 0; i < data1.length; i++) {
					$("#oneLevel").append(
						"<a href='ConmmodityListServlet?opr=categoryList&id="
						+ data1[i].id + "'>"
						+ data1[i].name + "</a>");
				}
			}

		$.getJSON("ConmmodityListServlet","opr=categorysBrandId&brand_id=1&level=2",callBack2);
			function callBack2(data2) {
				$("#twoLevel").html("");
				for ( var i = 0; i < data2.length; i++) {
					$("#twoLevel").append(
						"<a href='ConmmodityListServlet?opr=categoryListTwo&id="
						+ data2[i].id + "'>"
						+ data2[i].name + "</a>");
				}
			}
			
		$.getJSON("ConmmodityListServlet","opr=categorysBrandId&brand_id=1&level=3",callBack3);
			function callBack3(data3) {
				$("#threeLevel").html("");
				for ( var i = 0; i < data3.length; i++) {
					$("#threeLevel").append(
						"<a href='ConmmodityListServlet?opr=categoryListThree&id="
						+ data3[i].id + "'>"
						+ data3[i].name + "</a>");
				}
			}
		//点击品牌
		$(".now").click(function() {
			var brand_id = $(this).attr("name");
			$.getJSON("ConmmodityListServlet","opr=categorysBrandId&brand_id="+ brand_id+ "&level=1",callBack1);
				function callBack1(data1) {
					$("#oneLevel").text("");
					for ( var i = 0; i < data1.length; i++) {
						$("#oneLevel").append(
							"<a href='ConmmodityListServlet?opr=categoryList&id="
							+ data1[i].id+ "'>"
							+ data1[i].name
							+ "</a>");
					}
				}

			$.getJSON("ConmmodityListServlet","opr=categorysBrandId&brand_id="+ brand_id+ "&level=2",callBack2);
				function callBack2(data2) {
					$("#twoLevel").html("");
					for ( var i = 0; i < data2.length; i++) {
						$("#twoLevel").append(
							"<a href='ConmmodityListServlet?opr=categoryListTwo&id="
							+ data2[i].id
							+ "'>"
							+ data2[i].name
							+ "</a>");
					}
				}
			
			$.getJSON("ConmmodityListServlet","opr=categorysBrandId&brand_id="+ brand_id+ "&level=3",callBack3);
				function callBack3(data3) {
					$("#threeLevel").html("");
					for ( var i = 0; i < data3.length; i++) {
						$("#threeLevel").append(
							"<a href='ConmmodityListServlet?opr=categoryListThree&id="
							+ data3[i].id
							+ "'>"
							+ data3[i].name
							+ "</a>");
					}
				}

			$(".cate_list").html("");
			$.getJSON("BrandServlet","opr=brandIdProductCount&id="+ brand_id,callBackCount);
				function callBackCount(dataCount) {
					$(".fr").text("");
					$(".fr").text(
						"共发现"
						+ dataCount
						+ "件");
				}
			$.getJSON("BrandServlet","opr=brandIdListsNo&id="+ brand_id,callBack);
				function callBack(data) {
					for ( var i = 0; i < data.length; i++) {
						$(".cate_list").append(
							"<li>"
							+ "<div class='img'>"
							+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
							+ data[i].id
							+ "'><img src='/EasyBuy/statics/images/"+data[i].fileName+"' "+
							"width='210' height='185' />"
							+ "</a>"
							+ "</div>"
							+ "<div class='price'>"
							+ "<font>￥<span>"
							+ data[i].price
							+ "</span>"
							+ "</font>&nbsp;"
							+ data[i].integral
							+ "R"
							+ "</div>"
							+ "<div class='name'>"
							+ "<a href='#'>"
							+ data[i].name
							+ "</a>"
							+ "</div>"
							+ "<div class='carbg'>"
							+ "<a class='ss' title='"+data[i].id+"'>收藏</a> <a title='"+data[i].id+"' class='j_car'>加入购物车</a>"
							+ "</div>"
							+ "</li>");
					}
					shouCang();
					addCar();
				}
			$("#sheng").click(function() {
				$.getJSON("BrandServlet","opr=brandIdListsNoSheng&brand_id="+ brand_id,callBackSheng);
					function callBackSheng(dataSheng) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataSheng.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataSheng[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataSheng[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataSheng[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataSheng[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataSheng[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataSheng[i].id+"'>收藏</a> <a title='"+dataSheng[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#jiang").click(function() {
				$.getJSON("BrandServlet","opr=brandIdListsNoJiang&brand_id="+ brand_id,callBackJiang);
					function callBackJiang(dataJiang) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataJiang.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataJiang[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataJiang[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataJiang[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataJiang[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataJiang[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataJiang[i].id+"'>收藏</a> <a title='"+dataJiang[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#xiaoShang").click(function() {
				$.getJSON("BrandServlet","opr=brandIdListsNoShang&brand_id="+ brand_id,callBackShang);
					function callBackShang(dataShang) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataShang.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataShang[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataShang[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataShang[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataShang[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataShang[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataShang[i].id+"'>收藏</a> <a title='"+dataShang[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#xiaoXia").click(function() {
				$.getJSON("BrandServlet","opr=brandIdListsNoXia&brand_id="+ brand_id,callBackXia);
					function callBackXia(dataXia) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataXia.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXia[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXia[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXia[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXia[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXia[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXia[i].id+"'>收藏</a> <a title='"+dataXia[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#xin").click(function(){
				$.getJSON("BrandServlet","opr=brandIdListsNoXin&brand_id="+ brand_id,callBackXin);
			
			function callBackXin(dataXin){
				$(".cate_list").html("");
						for ( var i = 0; i < dataXin.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXin[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXin[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXin[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXin[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXin[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXin[i].id+"'>收藏</a> <a title='"+dataXin[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		});
		$("#sheng").click(function(){
			var categoryId=$(".cate_list").attr("title");
			if(categoryId.substring(categoryId.lastIndexOf("O"))=="O"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("O"));
				$.getJSON("ConmmodityListServlet","opr=categorySheng&id="+str+"&level=1",callBackShengC);
			}else if(categoryId.substring(categoryId.lastIndexOf("T"))=="T"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("T"));
				$.getJSON("ConmmodityListServlet","opr=categorySheng&id="+str+"&level=2",callBackShengC);
			}else if(categoryId.substring(categoryId.lastIndexOf("E"))=="E"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("E"));
				$.getJSON("ConmmodityListServlet","opr=categorySheng&id="+str+"&level=3",callBackShengC);
			}
			function callBackShengC(dataShengC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataShengC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataShengC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataShengC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataShengC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataShengC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataShengC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataShengC[i].id+"'>收藏</a> <a title='"+dataShengC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#jiang").click(function(){
			var categoryId=$(".cate_list").attr("title");
			if(categoryId.substring(categoryId.lastIndexOf("O"))=="O"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("O"));
				$.getJSON("ConmmodityListServlet","opr=categoryJiang&id="+str+"&level=1",callBackJiangC);
			}else if(categoryId.substring(categoryId.lastIndexOf("T"))=="T"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("T"));
				$.getJSON("ConmmodityListServlet","opr=categoryJiang&id="+str+"&level=2",callBackJiangC);
			}else if(categoryId.substring(categoryId.lastIndexOf("E"))=="E"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("E"));
				$.getJSON("ConmmodityListServlet","opr=categoryJiang&id="+str+"&level=3",callBackJiangC);
			}
			function callBackJiangC(dataJiangC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataJiangC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataJiangC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataJiangC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataJiangC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataJiangC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataJiangC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataJiangC[i].id+"'>收藏</a> <a title='"+dataJiangC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
							
		$(".fl list_or>a").mouseenter(function(){
			$(this).addClass("now");
		});
		shouCang();
		function shouCang(){
			$(".ss").click(function(){
			var productId=$(this).attr("title");
			var userId=$(".user").attr("title");
			$.getJSON("/EasyBuy/CollectServlet","opr=categoryShou&productId="+productId+"&userId="+userId,callBackShou);
			function callBackShou(dataShou){
				if(dataShou=="have"){
					alert("已有该收藏");
				}else if(dataShou=="success"){
					alert("收藏成功");
				}else if(dataShou=="error"){
					alert("收藏失败");
				}
			}
		});
		}
		$("#xin").click(function(){
			var categoryId=$(".cate_list").attr("title");
			if(categoryId.substring(categoryId.lastIndexOf("O"))=="O"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("O"));
				$.getJSON("ConmmodityListServlet","opr=categoryXin&id="+str+"&level=1",callBackXinC);
			}else if(categoryId.substring(categoryId.lastIndexOf("T"))=="T"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("T"));
				$.getJSON("ConmmodityListServlet","opr=categoryXin&id="+str+"&level=2",callBackXinC);
			}else if(categoryId.substring(categoryId.lastIndexOf("E"))=="E"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("E"));
				$.getJSON("ConmmodityListServlet","opr=categoryXin&id="+str+"&level=3",callBackXinC);
			}
			function callBackXinC(dataXinC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataXinC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXinC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXinC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXinC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXinC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXinC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXinC[i].id+"'>收藏</a> <a class='j_car' title='"+dataXinC[i].id+"'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#xiaoShang").click(function(){
			var categoryId=$(".cate_list").attr("title");
			if(categoryId.substring(categoryId.lastIndexOf("O"))=="O"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("O"));
				$.getJSON("ConmmodityListServlet","opr=categoryShang&id="+str+"&level=1",callBackShangC);
			}else if(categoryId.substring(categoryId.lastIndexOf("T"))=="T"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("T"));
				$.getJSON("ConmmodityListServlet","opr=categoryShang&id="+str+"&level=2",callBackShangC);
			}else if(categoryId.substring(categoryId.lastIndexOf("E"))=="E"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("E"));
				$.getJSON("ConmmodityListServlet","opr=categoryShang&id="+str+"&level=3",callBackShangC);
			}
			function callBackShangC(dataShangC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataShangC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataShangC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataShangC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataShangC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataShangC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataShangC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataShangC[i].id+"'>收藏</a> <a title='"+dataShangC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		
		$("#xiaoXia").click(function(){
			var categoryId=$(".cate_list").attr("title");
			if(categoryId.substring(categoryId.lastIndexOf("O"))=="O"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("O"));
				$.getJSON("ConmmodityListServlet","opr=categoryXia&id="+str+"&level=1",callBackXiaC);
			}else if(categoryId.substring(categoryId.lastIndexOf("T"))=="T"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("T"));
				$.getJSON("ConmmodityListServlet","opr=categoryXia&id="+str+"&level=2",callBackXiaC);
			}else if(categoryId.substring(categoryId.lastIndexOf("E"))=="E"){
				var str=categoryId.substring(0,categoryId.lastIndexOf("E"));
				$.getJSON("ConmmodityListServlet","opr=categoryXia&id="+str+"&level=3",callBackXiaC);
			}
			function callBackXiaC(dataXiaC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataXiaC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXiaC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXiaC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXiaC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXiaC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXiaC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXiaC[i].id+"'>收藏</a> <a title='"+dataXiaC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		addCar();
		//加入购物车
		function addCar(){
			$(".j_car").click(function(){
				if("${applicationScope.id}" == ""){
					location.href = "/EasyBuy/pre/Login.jsp";
				}else{
					var productId=$(this).attr("title");
					var userId=$(".user").attr("title");
					add();
					function add(){
						$.get("BuyCarServlet","opr=addBuyCar&uId="+userId+"&pId="+productId+"&pNum=1",function(data){
							if(data == "cg"){
								alert("添加成功");
							}else if(data=="sb"){
								alert("添加失败");
							}
						});
					}
				}
			});	
		}
		
	});
</script>
</html>
